Skip to main content

approveMulitpleAppointmentRating

approveMulitpleAppointmentRating

This method processes the approval or rejection of multiple appointment ratings in sequence, collecting individual results for each rating.

  1. Extract Input Data

    • Retrieve the agent_id and the list of ratings from the input DTO.
  2. Initialize Results Array

    • Create an empty array to store the outcome of each rating approval/rejection.
  3. Iterate Over Ratings

    • For each rating item in the input list:

      • Call the existing approveAppointmentRating method with the corresponding booking_id, status, and agent_id.

      • If the approval/rejection succeeds:

        • Add a success entry to the results array, including the booking_id, a success flag, and a success message.
      • If an error occurs during approval/rejection:

        • Catch the error and add a failure entry to the results array, including the booking_id, a failure flag, and the error message.
  4. Return Consolidated Results

    • Return an object containing the results array summarizing the status for each processed rating.